﻿@{
    ViewBag.Title = "配送与回收报表图（司机）";
}
@section styles{
    <link href="~/Theme/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="~/Theme/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <style type="text/css">
        .input-group[class*=col-] {
            padding: 0 15px;
        }
    </style>
}

<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12 ui-sortable">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>@ViewBag.Title</h5>
                    <div class="ibox-tools">
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="ibox float-e-margins">
                                <div class="ibox-content">
                                    <div class="row">
                                        <form class="form-horizontal" id="form" asp-controller="DistributionReport" asp-action="DistributionAndRecyclingByDriverReportData" data-ajax="true" data-ajax-method="Get" data-ajax-begin="AjaxBegin" data-ajax-success="GetMonthDistributionSorce">
                                            <div class="row m-b-sm">
                                                <div class="col-lg-4">
                                                    <label class="fl control-label" style="width: 70px;">选择月份：</label>
                                                   
                                                    <div class="input-group date">
                                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                                        <span style="position: relative;">
                                                            <input type="text" name="time" id="time" class="form-control" autocomplete="off"  value="@DateTime.Now.ToString("yyyy-MM")" />
                                                        </span>
                                                        <span class="input-group-btn">
                                                            <button type="submit" class="btn btn-sm btn-primary" style="padding:7px 12px"> 搜索</button>
                                                        </span>
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
                                        <div class="row col-lg-12">
                                            <div id="DistributionChar" style="height:600px">

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@section scripts{
    <script src="~/Theme/js/content.min.js?v=1.0.0"></script>
    <script src="~/Theme/js/plugins/iCheck/icheck.min.js"></script>
    <script src="~/Theme/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="~/Scripts/ECharts/echarts.js"></script>

    <script type="text/javascript">
        $(".date input").datepicker({
            todayBtn: "linked", keyboardNavigation: !1, forceParse: !1, calendarWeeks: !0, autoclose: !0,
            format: 'yyyy-mm',
            startView: 'months', //开始视图层，为月视图层
            maxViewMode: 'years', //最大视图层，为年视图层
            minViewMode: 'months', //最小视图层，为月视图层
            todayBtnName: '本月'
        });


        var myChart = echarts.init(document.getElementById('DistributionChar'));

        // 指定图表的配置项和数据
        var option = {
            color: ['#003366','#ff7800'],
            //title: {
            //    text: '营收趋势'
            //},
            tooltip: {
                confine: true,
                trigger: 'axis',
                axisPointer: {
                    type: 'shadow'
                },
                show: true,
                orient: 'vertical',
                left: 'right',
                top: 'center',
                feature: {
                    mark: { show: true },
                    dataView: { show: true, readOnly: false },
                    magicType: { show: true, type: ['line', 'bar', 'tiled'] },
                    restore: { show: true },
                    saveAsImage: { show: true }
                }
            },
            toolbox: {
                show: true,
                orient: 'vertical',
                left: 'right',
                top: 'center',
                feature: {
                    mark: { show: true },
                    dataView: { show: true, readOnly: false },
                    magicType: { show: true, type: ['line', 'bar', 'tiled'] },
                    restore: { show: true },
                    saveAsImage: { show: true }
                }
            },
            grid: {
                right: '10%',
                containLabel: true,
            },
            series: []
        };


        $(function () {
            myChart.setOption(option);
            var time = $('#time').val();
            $.ajax({
                url: "/DistributionReport/DistributionAndRecyclingByDriverReportData?time=" + time,
                method: "post",
                data: "json",
                success: function (result) {
                    myChart.setOption(result.result);

                }
            });
        })

        function GetMonthDistributionSorce(result, succinfo) {
            layer.closeAll();
            myChart.setOption(result.result);
        }




    </script>
}
